proc do_access {nick chan otbn1 host} {
global home botnick bcast
if {![validchan $chan]} {
  putquick "NOTICE $nick :$chan is not a registered channel."
  return 0
  } 
if {$otbn1 == ""} {
  putquick "NOTICE $nick :Please use: (/msg) $botnick access <#channel> <nick>"
  return 0
  } 
if {![onchan $otbn1 $chan]} {
  putquick "NOTICE $nick :$otbn1 isn't in $chan"
  return 0
  }
if {[validuser $otbn1]} {
  set hand2 $otbn1
  set hand3 [nick2hand $hand2 $chan]
  } elseif {[validuser [nick2hand $otbn1 $chan]]} {
  set hand2 $otbn1
  set hand3 [nick2hand $hand2 $chan]
  } else {
  putquick "NOTICE $nick :$otbn1 is not a valid user."
  return 0
  }
  set access "N/A"
if {[matchattr $hand3 |v $chan]} {
  set access "AVOICE"
  }
if {[matchattr $hand3 |a $chan]} {
  set access "AUTOOP"
  }
if {[matchattr $hand3 |o $chan]} {
  set access "CHANNEL OPERATOR"
  }
if {[matchattr $hand3 |m $chan]} {
  set access "CHANNEL CO-ADMINISTRATOR"
  }
if {[matchattr $hand3 |n $chan]} {
  set access "CHANNEL ADMINISTRATOR"
  }
  set rhosts [getuser $hand3 HOSTS]
  set comment [getchaninfo $hand3 $chan]
  putlog "!$nick ($host)! access $chan $hand3"
if {$bcast == "1"} {
  putquick "PRIVMSG $home :$nick!$host requested to see access for $hand3 on $chan ..showing..."   
  }
  putquick "NOTICE $nick :NICKNAME: $hand2"
  putquick "NOTICE $nick :UID: $hand3"
  putquick "NOTICE $nick :ACCESS IN $chan: $access"
  putquick "NOTICE $nick :COMMENT: $comment"
  putquick "NOTICE $nick :REMOTE HOSTNAMES: $rhosts" 
if {[matchattr $hand3 D]} {
  putquick "NOTICE $nick :$hand2 is a disabled user."
  return 0  
  }
if {[matchattr $hand3 n]} {
  putquick "NOTICE $nick :GLOBAL PERMISSIONS: BOTNET ADMINISTRATOR (root)"
  return 0
  }
if {[matchattr $hand3 m]} {
  putquick "NOTICE $nick :GLOBAL PERMISSIONS: BOTNET CO-ADMINISTRATOR"
  return 0
  }
if {[matchattr $hand3 o]} {
  putquick "NOTICE $nick :GLOBAL PERMISSIONS: BOTNET OPERATOR"
  return 0
  }
  return 0
  }









